import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.WeakHashMap;

public class Main {

    public static void main(String[] args) {
        int[] array=new int[]{4,1,2,1,2};
        for (int i = 0; i <array.length-1 ; i++) {
            boolean x=false;
            for (int j = i+1; j < array.length; j++) {
                if(array[i]==array[j]){
                    x=true;
                    break;
                }
            }
            if(!x){
                System.out.println(array[i]);
                break;
            }
        }
        
    }
    public static void main7(String[] args) {
        int[] nums=new int[]{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18};
        int  target;
        int x=0;
        int y=0;
        System.out.println("请输入目标值");
        Scanner scanner=new Scanner(System.in);
        target=scanner.nextInt();
        for (int i = 0; i <nums.length-1 ; i++) {
            for (int j = i+1; j <nums.length ; j++) {
                if(nums[i]+nums[j]==target){
                    x=i;
                    y=j;
                    break;
                }
            }
            if(y!=0){
                break;
            }
        }
        System.out.println("下标是:["+x+" "+y+"]");
    }
    public static void main6(String[] args) {
        int[] array=new int[]{1,3,2,5,4,6,9,7,0,8,11};
        for (int i = 0; i < array.length-1; i++) {
            for (int j = 0; j <array.length-i-1; j++) {
                if(array[j]>array[j+1]){
                    int swp =array[j];
                    array[j]=array[j+1];
                    array[j+1]=swp;

                }
            }
        }
        for (int i = 0; i <array.length ; i++) {
            System.out.print(array[i]+" ");
        }

    }
    public static void main5(String[] args) {
        int[] array=new int[]{1,2,3,4,5,6,7,8,9,10,11,12,13,14};
        int left=0;
        int riht=array.length-1;
        int mind;
        System.out.println("请输入你要查找的数据");
        Scanner scanner=new Scanner(System.in);
        int x=scanner.nextInt();
        while (left<=riht){
            mind=(left+riht)/2;
            if(mind>x){
                riht=mind;
            } else if (mind<x) {
                left=mind;
            }else {
                System.out.println("找到了，下标是："+(mind-1));
                return;
            }
        }
        if(left>riht){
            System.out.println("找不到数据");
        }

    }
    public static void main4(String[] args) {
        int[] array=new int[]{1,5,3,4,2,6};
        int left=0;
        int riht=array.length-1;
        while (left<riht){
            while (array[left]%2!=0){
                left++;
            }
            while (array[riht]%2==0){
                riht--;
            }
            if(left<riht){
                int swp=array[left];
                array[left]=array[riht];
                array[riht]=swp;
            }
        }
        for (int i = 0; i <array.length ; i++) {
            System.out.println(array[i]);
        }
    }
    public static void main3(String[] args) {
        int[] array=new int[]{1,5,3,4,2,6};
        int[] array1=new int[array.length];
        int left=0;
        int riht=array.length-1;
        for (int i = 0; i < array.length; i++) {
            if(array[i]%2==0){
                array1[riht]=array[i];
                riht--;
            }else{
                array1[left]=array[i];
                left++;
            }
        }
        for (int i = 0; i <array.length ; i++) {
            System.out.println(array1[i]);
        }
    }
    public static void transform(int[] array){
        for (int i = 0; i < array.length; i++) {
            array[i]*=2;
        }
    }
    public static void main2(String[] args) {
  int[] array=new int[]{1,2,3,4,5};
  transform(array);
        for (int i = 0; i <array.length ; i++) {
            System.out.println(array[i]);
        }
    }
    public static void main1(String[] args) {
        List<Character> list = new ArrayList<>();
        list.add('w');
        list.add('e');
        list.add('l');
        list.add('c');
        list.add('o');
        list.add('m');
        list.add('t');
        list.add('o');
        list.add('b');
        list.add('i');
        list.add('t');
        List<Character> list1 = new ArrayList<>();
        list1.add('c');
        list1.add('o');
        list1.add('m');
        list1.add('e');
         list1.remove(1);
        //System.out.println(c1);
        System.out.println(list1);
        List<String> list2=new ArrayList<>();
        list2.add("hh");
        list2.add("wq");
        list2.add("sb");
        String x=list2.remove(1);
        System.out.println(x);
        System.out.println(list2);
        /*for (char sc:list1) {
            if(list.contains(sc)){
                list.remove(sc);
            }
        }
        System.out.println(list);
    }*/
    }
}